<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2018-4-23
  Time: 19:59
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<html>
<head>
    <title>Title</title>
</head>
<body>


<sql:setDataSource var="ds"
                   driver="com.mysql.jdbc.Driver"
                   url="jdbc:mysql://localhost:3306/sctu_javaweb_2018"
                   user="root"
                   password="sctu123456"/>

<sql:query dataSource="${ds}" var="result">
    select * from t_users
</sql:query>

<c:forEach items="${result.rows}" var="item">
    <h1>${item.username} | ${item.password}</h1>
</c:forEach>


<sql:update dataSource="${ds}">
    update t_users set username=?,password=? where id=2
    <sql:param value="javaweb"/>
    <sql:param>admin</sql:param>
</sql:update>

你的IP地址是：${pageContext.request.remoteAddr}
</body>
</html>
